package burubaka.model;

import java.io.Serializable;
import java.util.Date;

import org.slim3.datastore.Attribute;
import org.slim3.datastore.Model;
import org.slim3.datastore.json.Json;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.Text;

@Model(schemaVersion = 1)
public class Handicapping implements Serializable {

	private static final long serialVersionUID = 1L;

	@Attribute(primaryKey = true, json = @Json(ignore = true))
	private Key key;

	@Attribute(version = true, json = @Json(ignore = true))
	private Long version;

	private int horseNo1 = 0;
	private int horseNo2 = 0;
	private int horseNo3 = 0;
	private int horseNo4 = 0;
	private int horseNo5 = 0;
	private int horseNo6 = 0;
	private String horseName1;
	private String horseName2;
	private String horseName3;
	private String horseName4;
	private String horseName5;
	private String horseName6;
	private String raceDate = null;
	private String raceName = "";
	private long wager = 0;// 賭け金
	private long withdrawal = 0;// 投票額
	private double withdrawalRate = 0;// 回収率
	@Attribute(json = @Json(ignore = true))
	private Text comment = new Text("");
	private int payOffFlag = 0;
	private Date updTime;

	/**
	 * Returns the key.
	 * 
	 * @return the key
	 */
	public Key getKey() {
		return key;
	}

	/**
	 * Sets the key.
	 * 
	 * @param key
	 *            the key
	 */
	public void setKey(Key key) {
		this.key = key;
	}

	/**
	 * Returns the version.
	 * 
	 * @return the version
	 */
	public Long getVersion() {
		return version;
	}

	/**
	 * Sets the version.
	 * 
	 * @param version
	 *            the version
	 */
	public void setVersion(Long version) {
		this.version = version;
	}

	public int getHorseNo1() {
		return horseNo1;
	}

	public void setHorseNo1(int horseNo1) {
		this.horseNo1 = horseNo1;
	}

	public int getHorseNo2() {
		return horseNo2;
	}

	public void setHorseNo2(int horseNo2) {
		this.horseNo2 = horseNo2;
	}

	public int getHorseNo3() {
		return horseNo3;
	}

	public void setHorseNo3(int horseNo3) {
		this.horseNo3 = horseNo3;
	}

	public int getHorseNo4() {
		return horseNo4;
	}

	public void setHorseNo4(int horseNo4) {
		this.horseNo4 = horseNo4;
	}

	public int getHorseNo5() {
		return horseNo5;
	}

	public void setHorseNo5(int horseNo5) {
		this.horseNo5 = horseNo5;
	}

	public int getHorseNo6() {
		return horseNo6;
	}

	public void setHorseNo6(int horseNo6) {
		this.horseNo6 = horseNo6;
	}

	public String getHorseName1() {
		return horseName1;
	}

	public void setHorseName1(String horseName1) {
		this.horseName1 = horseName1;
	}

	public String getHorseName2() {
		return horseName2;
	}

	public void setHorseName2(String horseName2) {
		this.horseName2 = horseName2;
	}

	public String getHorseName3() {
		return horseName3;
	}

	public void setHorseName3(String horseName3) {
		this.horseName3 = horseName3;
	}

	public String getHorseName4() {
		return horseName4;
	}

	public void setHorseName4(String horseName4) {
		this.horseName4 = horseName4;
	}

	public String getHorseName5() {
		return horseName5;
	}

	public void setHorseName5(String horseName5) {
		this.horseName5 = horseName5;
	}

	public String getHorseName6() {
		return horseName6;
	}

	public void setHorseName6(String horseName6) {
		this.horseName6 = horseName6;
	}

	public String getRaceDate() {
		return raceDate;
	}

	public void setRaceDate(String raceDate) {
		this.raceDate = raceDate;
	}

	public String getRaceName() {
		return raceName;
	}

	public void setRaceName(String raceName) {
		this.raceName = raceName;
	}

	public long getWager() {
		return wager;
	}

	public void setWager(long wager) {
		this.wager = wager;
	}

	public long getWithdrawal() {
		return withdrawal;
	}

	public void setWithdrawal(long withdrawal) {
		this.withdrawal = withdrawal;
	}

	public double getWithdrawalRate() {
		return withdrawalRate;
	}

	public void setWithdrawalRate(double withdrawalRate) {
		this.withdrawalRate = withdrawalRate;
	}

	public Text getComment() {
		return comment;
	}

	public void setComment(Text comment) {
		this.comment = comment;
	}

	public String getCommentStr() {
		return comment.getValue();
	}

	public void setCommentStr(String commentStr) {
		this.comment = new Text(commentStr);
	}

	public int getPayOffFlag() {
		return payOffFlag;
	}

	public void setPayOffFlag(int payOffFlag) {
		this.payOffFlag = payOffFlag;
	}

	public Date getUpdTime() {
		return updTime;
	}

	public void setUpdTime(Date updTime) {
		this.updTime = updTime;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((key == null) ? 0 : key.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Handicapping other = (Handicapping) obj;
		if (key == null) {
			if (other.key != null) {
				return false;
			}
		} else if (!key.equals(other.key)) {
			return false;
		}
		return true;
	}
}
